using System.ServiceModel;
using System.ServiceModel.Channels;
namespace jSLApp.Client.MainService {
public class MainServiceSyncedChannel
{
private MainServiceChannel _asyncChannel;
#region Constructors
        public MainServiceSyncedChannel(string endpointConfigurationName, EndpointAddress remoteAddress)
        {
            var factory = new ChannelFactory<MainServiceChannel>(endpointConfigurationName, remoteAddress);
            CreateChannel(factory);
        }

        public MainServiceSyncedChannel(Binding binding, EndpointAddress rem)
        {
            var factory = new ChannelFactory<MainServiceChannel>(binding, rem);
            CreateChannel(factory);
        }

        public MainServiceSyncedChannel(string endpointConfigurationName)
        {
            var factory = new ChannelFactory<MainServiceChannel>(endpointConfigurationName);
            CreateChannel(factory);
        }

        private void CreateChannel(ChannelFactory<MainServiceChannel> factory)
        {
            _asyncChannel = factory.CreateChannel();
        }

        #endregion


public void SetSelectedFilm(int id)
{
var result = _asyncChannel.BeginSetSelectedFilm(id,null,null);
_asyncChannel.EndSetSelectedFilm(result);
}
public jSLApp.Client.MainService.PaymentModule[] GetPaymentModules()
{
var result = _asyncChannel.BeginGetPaymentModules(null,null);
return _asyncChannel.EndGetPaymentModules(result);
}
public jSLApp.Client.MainService.Payment[] GetUserPayments(string userName)
{
var result = _asyncChannel.BeginGetUserPayments(userName,null,null);
return _asyncChannel.EndGetUserPayments(result);
}
public void CheckOut(int filmId)
{
var result = _asyncChannel.BeginCheckOut(filmId,null,null);
_asyncChannel.EndCheckOut(result);
}
public void DeleteTag(string tag)
{
var result = _asyncChannel.BeginDeleteTag(tag,null,null);
_asyncChannel.EndDeleteTag(result);
}
public void SiteVisit()
{
var result = _asyncChannel.BeginSiteVisit(null,null);
_asyncChannel.EndSiteVisit(result);
}
public bool IsFilmReadyForCurrentUser(int filmId)
{
var result = _asyncChannel.BeginIsFilmReadyForCurrentUser(filmId,null,null);
return _asyncChannel.EndIsFilmReadyForCurrentUser(result);
}
public jSLApp.Client.MainService.CheckOut[] GetUserCheckouts(string userName)
{
var result = _asyncChannel.BeginGetUserCheckouts(userName,null,null);
return _asyncChannel.EndGetUserCheckouts(result);
}
public decimal GetUserBalance(string userName)
{
var result = _asyncChannel.BeginGetUserBalance(userName,null,null);
return _asyncChannel.EndGetUserBalance(result);
}
public decimal GetCurrentBalance()
{
var result = _asyncChannel.BeginGetCurrentBalance(null,null);
return _asyncChannel.EndGetCurrentBalance(result);
}
public byte[] GetFilmLastPhoto(int id)
{
var result = _asyncChannel.BeginGetFilmLastPhoto(id,null,null);
return _asyncChannel.EndGetFilmLastPhoto(result);
}
public byte[] GetBigCover(int id)
{
var result = _asyncChannel.BeginGetBigCover(id,null,null);
return _asyncChannel.EndGetBigCover(result);
}
public jSLApp.Client.MainService.Film[] GetTopFilms()
{
var result = _asyncChannel.BeginGetTopFilms(null,null);
return _asyncChannel.EndGetTopFilms(result);
}
public jSLApp.Client.MainService.Film GetRandomFilm()
{
var result = _asyncChannel.BeginGetRandomFilm(null,null);
return _asyncChannel.EndGetRandomFilm(result);
}
public jSLApp.Client.MainService.Film[] GetFilms(int[] ids)
{
var result = _asyncChannel.BeginGetFilms(ids,null,null);
return _asyncChannel.EndGetFilms(result);
}
public jSLApp.Client.MainService.Film CreateNewFilm(string name)
{
var result = _asyncChannel.BeginCreateNewFilm(name,null,null);
return _asyncChannel.EndCreateNewFilm(result);
}
public int[] SearchFilms(string searchText, bool onlyByName, System.Nullable<int> genreId)
{
var result = _asyncChannel.BeginSearchFilms(searchText,onlyByName,genreId,null,null);
return _asyncChannel.EndSearchFilms(result);
}
public jSLApp.Client.MainService.Film GetFilm(int id)
{
var result = _asyncChannel.BeginGetFilm(id,null,null);
return _asyncChannel.EndGetFilm(result);
}
public void SetFilmName(int id, string name)
{
var result = _asyncChannel.BeginSetFilmName(id,name,null,null);
_asyncChannel.EndSetFilmName(result);
}
public void SetFilmDescription(int id, string description)
{
var result = _asyncChannel.BeginSetFilmDescription(id,description,null,null);
_asyncChannel.EndSetFilmDescription(result);
}
public void SetFilmCountry(int id, string coutry)
{
var result = _asyncChannel.BeginSetFilmCountry(id,coutry,null,null);
_asyncChannel.EndSetFilmCountry(result);
}
public byte[] ChangeFilmImage(int filmId, byte[] bs)
{
var result = _asyncChannel.BeginChangeFilmImage(filmId,bs,null,null);
return _asyncChannel.EndChangeFilmImage(result);
}
public bool GetAgeOfCurrentUser()
{
var result = _asyncChannel.BeginGetAgeOfCurrentUser(null,null);
return _asyncChannel.EndGetAgeOfCurrentUser(result);
}
public void SetAgeOfCurrentUser()
{
var result = _asyncChannel.BeginSetAgeOfCurrentUser(null,null);
_asyncChannel.EndSetAgeOfCurrentUser(result);
}
public jSLApp.Client.MainService.Photo SetImageScreen(int filmId, byte[] bs)
{
var result = _asyncChannel.BeginSetImageScreen(filmId,bs,null,null);
return _asyncChannel.EndSetImageScreen(result);
}
public void DeleteGenre(int id)
{
var result = _asyncChannel.BeginDeleteGenre(id,null,null);
_asyncChannel.EndDeleteGenre(result);
}
public jSLApp.Client.MainService.Genre AddGenre(string name)
{
var result = _asyncChannel.BeginAddGenre(name,null,null);
return _asyncChannel.EndAddGenre(result);
}
public jSLApp.Client.MainService.Genre[] GetGenres()
{
var result = _asyncChannel.BeginGetGenres(null,null);
return _asyncChannel.EndGetGenres(result);
}
public jSLApp.Client.MainService.Film[] GetRelated(int filmId)
{
var result = _asyncChannel.BeginGetRelated(filmId,null,null);
return _asyncChannel.EndGetRelated(result);
}
public void SetFilmYear(int id, int year)
{
var result = _asyncChannel.BeginSetFilmYear(id,year,null,null);
_asyncChannel.EndSetFilmYear(result);
}
public void SetFilmGenre(int id, int genreId)
{
var result = _asyncChannel.BeginSetFilmGenre(id,genreId,null,null);
_asyncChannel.EndSetFilmGenre(result);
}
public void SetFilmPrice(int id, decimal price)
{
var result = _asyncChannel.BeginSetFilmPrice(id,price,null,null);
_asyncChannel.EndSetFilmPrice(result);
}
public void SetFilmIsAgeNeed(int id, bool needAge)
{
var result = _asyncChannel.BeginSetFilmIsAgeNeed(id,needAge,null,null);
_asyncChannel.EndSetFilmIsAgeNeed(result);
}
public void SubmitPasswordChange(System.Guid pwdCode, string newPwd)
{
var result = _asyncChannel.BeginSubmitPasswordChange(pwdCode,newPwd,null,null);
_asyncChannel.EndSubmitPasswordChange(result);
}
public void SubmitEMail(System.Guid code)
{
var result = _asyncChannel.BeginSubmitEMail(code,null,null);
_asyncChannel.EndSubmitEMail(result);
}
public void SetFilmIsSmoothStreaming(int id, bool isSmoothStreaming)
{
var result = _asyncChannel.BeginSetFilmIsSmoothStreaming(id,isSmoothStreaming,null,null);
_asyncChannel.EndSetFilmIsSmoothStreaming(result);
}
public string[] GetAllTags()
{
var result = _asyncChannel.BeginGetAllTags(null,null);
return _asyncChannel.EndGetAllTags(result);
}
public void SetFilmTags(int id, string tags)
{
var result = _asyncChannel.BeginSetFilmTags(id,tags,null,null);
_asyncChannel.EndSetFilmTags(result);
}
public bool CanRate(int filmId)
{
var result = _asyncChannel.BeginCanRate(filmId,null,null);
return _asyncChannel.EndCanRate(result);
}
public double AddRating(int filmdId, double rate)
{
var result = _asyncChannel.BeginAddRating(filmdId,rate,null,null);
return _asyncChannel.EndAddRating(result);
}
public void DeleteComment(int commentId)
{
var result = _asyncChannel.BeginDeleteComment(commentId,null,null);
_asyncChannel.EndDeleteComment(result);
}
public jSLApp.Client.MainService.Comment AddComment(int filmdId, string content)
{
var result = _asyncChannel.BeginAddComment(filmdId,content,null,null);
return _asyncChannel.EndAddComment(result);
}
public jSLApp.Client.MainService.Comment[] GetComments(int filmId)
{
var result = _asyncChannel.BeginGetComments(filmId,null,null);
return _asyncChannel.EndGetComments(result);
}
public void SetFilmIsRecomended(int id, bool isRecomended)
{
var result = _asyncChannel.BeginSetFilmIsRecomended(id,isRecomended,null,null);
_asyncChannel.EndSetFilmIsRecomended(result);
}
public void SetFilmIsPublic(int id, bool isPublic)
{
var result = _asyncChannel.BeginSetFilmIsPublic(id,isPublic,null,null);
_asyncChannel.EndSetFilmIsPublic(result);
}
public void SetFilmSource(int id, string source)
{
var result = _asyncChannel.BeginSetFilmSource(id,source,null,null);
_asyncChannel.EndSetFilmSource(result);
}
public void SendFeedback(string text)
{
var result = _asyncChannel.BeginSendFeedback(text,null,null);
_asyncChannel.EndSendFeedback(result);
}
public void SendMailToUser(string login, string message)
{
var result = _asyncChannel.BeginSendMailToUser(login,message,null,null);
_asyncChannel.EndSendMailToUser(result);
}
public void SetFilmTrailer(int id, string source)
{
var result = _asyncChannel.BeginSetFilmTrailer(id,source,null,null);
_asyncChannel.EndSetFilmTrailer(result);
}
public void SetFilmEnName(int id, string enName)
{
var result = _asyncChannel.BeginSetFilmEnName(id,enName,null,null);
_asyncChannel.EndSetFilmEnName(result);
}
public void DeleteUser(string login)
{
var result = _asyncChannel.BeginDeleteUser(login,null,null);
_asyncChannel.EndDeleteUser(result);
}
public void ManualAcceptMail(string login)
{
var result = _asyncChannel.BeginManualAcceptMail(login,null,null);
_asyncChannel.EndManualAcceptMail(result);
}
public void ResetPassword(string login, string mail)
{
var result = _asyncChannel.BeginResetPassword(login,mail,null,null);
_asyncChannel.EndResetPassword(result);
}
public void Registration(string login, string pwd, string mail)
{
var result = _asyncChannel.BeginRegistration(login,pwd,mail,null,null);
_asyncChannel.EndRegistration(result);
}
public jSLApp.Client.MainService.SystemLog[] GetLogs()
{
var result = _asyncChannel.BeginGetLogs(null,null);
return _asyncChannel.EndGetLogs(result);
}
public jSLApp.Client.MainService.Role[] GetAllRoles()
{
var result = _asyncChannel.BeginGetAllRoles(null,null);
return _asyncChannel.EndGetAllRoles(result);
}
public void SetIsEnabled(string login, bool isEnabled)
{
var result = _asyncChannel.BeginSetIsEnabled(login,isEnabled,null,null);
_asyncChannel.EndSetIsEnabled(result);
}
public void RoleChange(string login, System.Guid newRole)
{
var result = _asyncChannel.BeginRoleChange(login,newRole,null,null);
_asyncChannel.EndRoleChange(result);
}
public jSLApp.Client.MainService.User GetUser(string login)
{
var result = _asyncChannel.BeginGetUser(login,null,null);
return _asyncChannel.EndGetUser(result);
}
public jSLApp.Client.MainService.User[] SearchUser(string searchText, bool showUnaccepted)
{
var result = _asyncChannel.BeginSearchUser(searchText,showUnaccepted,null,null);
return _asyncChannel.EndSearchUser(result);
}
public void DeleteFilm(int id)
{
var result = _asyncChannel.BeginDeleteFilm(id,null,null);
_asyncChannel.EndDeleteFilm(result);
}
public jSLApp.Client.MainService.FileEntry[] GetFreeFiles()
{
var result = _asyncChannel.BeginGetFreeFiles(null,null);
return _asyncChannel.EndGetFreeFiles(result);
}
public void DeleteFile(string fileName)
{
var result = _asyncChannel.BeginDeleteFile(fileName,null,null);
_asyncChannel.EndDeleteFile(result);
}
public jSLApp.Client.MainService.Photo[] GetPhotos(int filmId)
{
var result = _asyncChannel.BeginGetPhotos(filmId,null,null);
return _asyncChannel.EndGetPhotos(result);
}

}
}
